#!/bin/bash
if [ -n '$1' ]; then
    data_date=$1
else
    data_date=`date -d "-1 days"+%F`
fi
sqoop import \
--connect  jdbc:mysql://node101:3306/jtp_app_shujuku    \
--username root      \
--password 123456   \
-query 'SELECT ID,AREANAME,PARENTID,SHORTNAME,LEVEL,FLAG,WGS84_LNG,WGS84_LAT,GCJ02_LNG,GCJ02_LAT,BD09_LNG,BD09_LAT FROM t_md_areas WHERE $CONDITIONS ;' \
--delete-target-dir \
--target-dir "hdfs://node101:8020/warehouse/app_basic/t_md_areas/${data_date}" \
--fields-terminated-by '\001’     \
--num-mappers 1        \
--null-string '\\N' \
--null-non-string '\\N'